home *** CD-ROM | disk | FTP | other *** search
- Path: tech.cftnet.com!not-for-mail
- From: wcowley@cftnet.com (Wes Cowley)
- Newsgroups: comp.lang.c++
- Subject: Re: Constructors for objects that can be FALSE
- Date: 15 Feb 1996 11:17:49 GMT
- Organization: CFTnet
- Message-ID: <4fv4ou$l4t@tech.cftnet.com>
- References: <4fusaq$g1e@due.unit.no>
- NNTP-Posting-Host: ppp244_4.cftnet.com
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Rolf Rustad (rustad@fm.unit.no) wrote:
-
- : What I would like is to make objects of these classes evaluate to FALSE
- : if the physical device is not present or available, as do for instanse
- : ifpstream:
- :
- : ifpstream is(filename);
- : if(!is){
- : .
- : .
- : }
- :
- : How do I write the constructor??
-
- One possibility is to have the constructor store some indication of the
- status of the device. Then provide an operator int() that returns a
- result that can be tested in the if.
-
- Wes
-
-